//
//  ReleaseAdviceView.m
//  yonghu
//
//  Created by 浪尖渝力 on 2018/1/19.
//  Copyright © 2018年 com.DJS. All rights reserved.
//

#import "ReleaseAdviceView.h"
#import "SelectCaseView.h"
#import "PayView3Controller.h"
#import "PingJiaViewController.h"
#import "OKViewController.h"
@implementation ReleaseAdviceView


-(void)creatView{
    self.backgroundColor=_LightGrey;
    _scrollView=[UIScrollView new];
    [self addSubview:_scrollView];
    [_scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(0);
        make.left.right.mas_equalTo(0);
        make.bottom.mas_equalTo(0);
    }];
    _scrollView.scrollsToTop =NO;
    
    _scrollView.showsVerticalScrollIndicator = FALSE;
    _scrollView.showsHorizontalScrollIndicator = FALSE;
    _scrollView.bounces = NO;
    if (@available(iOS 11.0, *)) {
        self.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    } else {
        self.viewController.automaticallyAdjustsScrollViewInsets = NO;
    }
    
    
    UIView *topView=[UIView new];
    [_scrollView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.top.mas_equalTo(NAV_HEIGHT);
        make.width.mas_equalTo(_mainW);
        make.height.mas_equalTo(120);
    }];
    [self creatTopView:topView];
    
    if (_dic==nil) {
        [self creatXieWenShu];
    }
    if (_dic!=nil) {
        NSNumber *document_status=[_dic objectForKey:@"consult_status"];
        if (document_status.integerValue==0) {
            [self LvSiFuWu];
        }
        if (document_status.integerValue==1) {
            [self PingJiView];
            
            UIButton *btn1=[UIButton new];
            [self addSubview:btn1];
            [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(0);
                make.width.mas_equalTo(_mainW);
                make.height.mas_equalTo(50);
                make.bottom.mas_equalTo(0);
            }];
            [btn1 setTitle:@"立即评价" forState:0];
            [btn1 setTitleColor:[UIColor whiteColor] forState:0];
            btn1.backgroundColor=_backgroundColor;
            [btn1 addTarget:self action:@selector(pijiama:) forControlEvents:UIControlEventTouchUpInside];
        }
        
        if (document_status.integerValue==2) {
            [self wanChengView];
            
        }

    }
    
}
-(void)creatTopView:(UIView *)topView{
    UIView *xianView=[UIView new];
    [topView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(25);
        make.right.mas_equalTo(-25);
        make.top.mas_equalTo(35);
        make.height.mas_equalTo(1.5);
    }];
    xianView.backgroundColor=ColorWithRGB(200, 200, 201);
    
    NSArray *arr=[NSArray arrayWithObjects:@"发布需求",@"律师服务",@"评价",@"完成", nil];
    
    int index=0;
    if (_dic!=nil) {
        NSNumber *document_status=[_dic objectForKey:@"consult_status"];
        index=document_status.intValue+1;
    }
    for (int i=0; i<arr.count; i++) {
        UIImageView *imageView=[UIImageView new];
        [topView addSubview:imageView];
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(((_mainW-70)/3)*i+25);
            make.centerY.mas_equalTo(xianView);
            if (i==index) {
                make.width.height.mas_equalTo(33);
            }
            else{
                make.width.height.mas_equalTo(25);
            }
        }];
        if (i>index) {
            imageView.image=[UIImage imageNamed:@"圆-1"];
        }
        else if (index==i) {
            imageView.image=[UIImage imageNamed:@"圆3"];
        }
        else if (index>i){
            imageView.image=[UIImage imageNamed:@"圆2"];
        }
        
        UILabel *label=[UILabel new];
        [topView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(imageView);
            make.bottom.mas_equalTo(-20);
        }];
        label.text=arr[i];
        if (index==i) {
            label.textColor=_backgroundColor;
            label.font=[UIFont systemFontOfSize:18];
        }
        else{
            label.textColor=ColorWithRGB(149, 149, 149);
            label.font=[UIFont systemFontOfSize:15];
        }
    }
}
-(void)creatXieWenShu{
    UIView *topView=[UIView new];
    [_scrollView addSubview:topView];
    [topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(360);
        make.top.mas_equalTo(190);
    }];
    topView.backgroundColor=[UIColor whiteColor];
    topView.layer.cornerRadius=3;
    
    UIView *leiXinView=[UIView new];
    [topView addSubview:leiXinView];
    [leiXinView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.left.top.mas_equalTo(0);
        make.height.mas_equalTo(55);
    }];
    
    leiXinView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tuiChuView = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(SelectDocument:)];
    [leiXinView addGestureRecognizer:tuiChuView];
    
    
    UIImageView *nameImage=[UIImageView new];
    [leiXinView addSubview:nameImage];
    [nameImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(10);
        make.width.mas_equalTo(15);
        make.height.mas_equalTo(20);
    }];
    nameImage.image=[UIImage imageNamed:@"案件类型"];
    
    UILabel *nameLabel=[UILabel new];
    [leiXinView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(nameImage.mas_right).mas_equalTo(10);
        make.centerY.mas_equalTo(0);
    }];
    nameLabel.font=[UIFont systemFontOfSize:17];
    nameLabel.text=@"案件类型";
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    
    
    
    UIImageView *imgaeView=[UIImageView new];
    [leiXinView addSubview:imgaeView];
    [imgaeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(12);
        make.height.mas_equalTo(20);
    }];
    imgaeView.image=[UIImage imageNamed:@"iconfont-fanhui-拷贝-3"];
    
    _leiXinLabel=[UILabel new];
    [leiXinView addSubview:_leiXinLabel];
    [_leiXinLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(imgaeView.mas_left).mas_equalTo(-5);
        make.centerY.mas_equalTo(0);
        make.left.mas_equalTo(150);
    }];
    _leiXinLabel.textAlignment=NSTextAlignmentRight;
    _leiXinLabel.text=@"";
    _leiXinLabel.font=[UIFont systemFontOfSize:15];
    _leiXinLabel.textColor=ColorWithRGB(49, 49, 49);
    
    UIView *xianView=[UIView new];
    [topView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(55);
        make.right.mas_equalTo(-5);
        make.height.mas_equalTo(1);
    }];
    xianView.backgroundColor=_LightGrey;
    
    
    UIView *xianView2=[UIView new];
    [topView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.top.mas_equalTo(leiXinView.mas_bottom);
        make.right.mas_equalTo(-5);
        make.height.mas_equalTo(1);
    }];
    xianView2.backgroundColor=_LightGrey;
    
    
    _textView=[UITextView new];
    [topView addSubview:_textView];
    [_textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(xianView);
        make.bottom.mas_equalTo(-35);
        make.top.mas_equalTo(xianView2.mas_bottom).mas_equalTo(20);
        
    }];
    _textView.backgroundColor=[UIColor whiteColor];
    _textView.returnKeyType=UIReturnKeyDone;
    _textView.delegate=self;
    _textView.text=@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…";
    _textView.textColor=ColorWithRGB(149, 149, 149);
    _textView.font=[UIFont systemFontOfSize:15];
    
    _numLabel=[UILabel new];
    [topView addSubview:_numLabel];
    [_numLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(xianView2);
        make.bottom.mas_equalTo(-5);
    }];
    _numLabel.textColor=ColorWithRGB(149, 149, 149);
    _numLabel.font=[UIFont systemFontOfSize:14];
    _numLabel.text=@"0/200";

    UILabel *xieYiLabel=[UILabel new];
    [_scrollView addSubview:xieYiLabel];
    [xieYiLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(topView.mas_bottom).mas_equalTo(20);
        make.right.mas_equalTo(-10);
    }];
    xieYiLabel.numberOfLines=0;
    NSMutableAttributedString *AttributedStr= [[NSMutableAttributedString alloc]initWithString:@"温馨提示：付费咨询更高效！费用越高，回复效率和质量越高！"];
    
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(149, 149, 149) range:NSMakeRange(0, 13)];
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(149, 149, 149) range:NSMakeRange(17, 3)];
      [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(149, 149, 149) range:NSMakeRange(27, 1)];
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(186, 151, 89) range:NSMakeRange(13, 4)];
    [AttributedStr addAttribute:NSForegroundColorAttributeName value:ColorWithRGB(186, 151, 89) range:NSMakeRange(20, 7)];
    xieYiLabel.attributedText=AttributedStr;
    xieYiLabel.font=[UIFont systemFontOfSize:14];
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    
    NSString *isOrSH=[user objectForKey:@"isOrSH"];
    if (isOrSH.integerValue==0) {
        UIButton *btn1=[UIButton new];
        [self addSubview:btn1];
        [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(0);
            make.width.mas_equalTo(_mainW/2);
            make.height.mas_equalTo(50);
            make.bottom.mas_equalTo(0);
        }];
        [btn1 setTitle:@"付费发布" forState:0];
        [btn1 setTitleColor:[UIColor whiteColor] forState:0];
        btn1.backgroundColor=ColorWithRGB(183, 157, 108);
        [btn1 addTarget:self action:@selector(tiJiao:) forControlEvents:UIControlEventTouchUpInside];
        
        UIButton *btn2=[UIButton new];
        [self addSubview:btn2];
        [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(btn1.mas_right);
            make.width.mas_equalTo(_mainW/2);
            make.height.mas_equalTo(50);
            make.bottom.mas_equalTo(0);
        }];
        [btn2 setTitle:@"免费发布" forState:0];
        [btn2 setTitleColor:[UIColor whiteColor] forState:0];
        btn2.backgroundColor=ColorWithRGB(93, 148, 172);
        [btn2 addTarget:self action:@selector(tiJiao2:) forControlEvents:UIControlEventTouchUpInside];
        _scrollView.contentSize = CGSizeMake(0,800);
    }
    else{
        UIButton *btn2=[UIButton new];
        [self addSubview:btn2];
        [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(0);
            make.width.mas_equalTo(_mainW);
            make.height.mas_equalTo(50);
            make.bottom.mas_equalTo(0);
        }];
        [btn2 setTitle:@"免费发布" forState:0];
        [btn2 setTitleColor:[UIColor whiteColor] forState:0];
        btn2.backgroundColor=ColorWithRGB(93, 148, 172);
        [btn2 addTarget:self action:@selector(tiJiao2:) forControlEvents:UIControlEventTouchUpInside];
        _scrollView.contentSize = CGSizeMake(0,800);
    }
   
}

-(void)wanChengView{
    
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_pingJiaView removeFromSuperview];
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"user_nickname"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.width.mas_equalTo(_mainW*0.4);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSNumber *time=[_dic objectForKey:@"consult_time"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=[ZQTools changeTimeCuo:@"YYYY-MM-dd HH:mm:ss" :[NSString stringWithFormat:@"%@",time]];
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"consult_ct_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        if (size.width>_mainW*0.4) {
            make.width.mas_equalTo(_mainW*0.4);
        }else
        {
            make.width.mas_equalTo(size.width+14);
        }
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSString *document_content=[_dic objectForKey:@"consult_content"];
 
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=3;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    if (size2.height>65) {
        contentLabel.numberOfLines=2;
        UIImageView *imageView2=[UIImageView new];
        [_topView addSubview:imageView2];
        [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(0);
            make.bottom.mas_equalTo(-5);
            make.width.mas_equalTo(22);
            make.height.mas_equalTo(14);
        }];
        imageView2.image=[UIImage imageNamed:@"展开"];
//        imageView2.userInteractionEnabled=YES;
//        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wanChengView2)];
//        [imageView2 addGestureRecognizer:tapGesture];
        
        UIView *anView=[UIView new];
        [_topView addSubview:anView];
        [anView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.mas_equalTo(0);
            make.top.mas_equalTo(contentLabel);
        }];
        anView.userInteractionEnabled=YES;
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wanChengView2)];
        [anView addGestureRecognizer:tapGesture];
        
    }
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(15);
        make.width.height.mas_equalTo(50);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=25;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel=[UILabel new];
    [_LSView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    nameLabel.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    for (int i=0; i<biaoQian.count; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    NSData *Data=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.djiaoshou.com/yuyin.gif"]];
    UIImage *image=[UIImage imageWithData:Data];

    
    _shiTing=[UIImageView new];
    [_LSView addSubview:_shiTing];
    [_shiTing mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(40/image.size.height*image.size.width);
        make.top.mas_equalTo(userImage.mas_bottom).mas_equalTo(20);
    }];
    _shiTing.image=[UIImage imageNamed:@"录音"];
    _shiTing.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(creatBoFang)];
    [_shiTing addGestureRecognizer:tapGesture4];
    
    UILabel *timelabel=[UILabel new];
    [_LSView addSubview:timelabel];
    [timelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_shiTing.mas_right).mas_equalTo(10);
        make.centerY.mas_equalTo(_shiTing);
    }];
    
    timelabel.textColor=ColorWithRGB(149, 149, 149);
    NSNumber *sl_time_long=[_dic objectForKey:@"sl_time_long"];
    timelabel.text=[NSString stringWithFormat:@"%@'",sl_time_long];
    
    
    
    NSString *evaluate_content=[_dic objectForKey:@"evaluate_content"];
    CGSize size3=[ZQTools getNSStringSize:evaluate_content andViewWight:_mainW-40 andFont:17];
    _pingJiaView=[UIView new];
    [_scrollView addSubview:_pingJiaView];
    [_pingJiaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(80+size3.height);
        make.top.mas_equalTo(_LSView.mas_bottom).mas_equalTo(20);
    }];
    _pingJiaView.backgroundColor=[UIColor whiteColor];
    _pingJiaView.layer.cornerRadius=3;
    
    UIView *xianView2=[UIView new];
    [_pingJiaView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView2.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel2=[UILabel new];
    [_pingJiaView addSubview:woDeLabel2];
    [woDeLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView2);
        make.left.mas_equalTo(xianView2.mas_right).mas_equalTo(10);
    }];
    woDeLabel2.text=@"我的评价";
    woDeLabel2.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel2.font=[UIFont systemFontOfSize:22];
    
    NSNumber *evaluate_score=[_dic objectForKey:@"evaluate_score"];
    int typeNum2=evaluate_score.doubleValue*10;
    int typeNum=typeNum2%10;
    int index=5-evaluate_score.floatValue;

    
    for (int i=0; i<5; i++) {
        UIImageView *xingImage=[UIImageView new];
        [_pingJiaView addSubview:xingImage];
        [xingImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-10-25*i);
            make.height.width.mas_equalTo(20);
            make.centerY.mas_equalTo(woDeLabel2);
        }];
        
         if (typeNum>0) {
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
             if (i==index) {
                 xingImage.image=[UIImage imageNamed:@"评分3"];
             }
             if (i>index) {
                 xingImage.image=[UIImage imageNamed:@"评分2"];
             }
        }
        else{
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
            else{
                xingImage.image=[UIImage imageNamed:@"评分2"];
            }
        }
    }
    
    UILabel *pingFen=[UILabel new];
    [_pingJiaView addSubview:pingFen];
    [pingFen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(woDeLabel2);
        make.right.mas_equalTo(-140);
    }];
    pingFen.text=@"评分:";
    pingFen.textColor=ColorWithRGB(149, 149, 149);
    pingFen.font=[UIFont systemFontOfSize:16];
    
    UILabel *lable12=[UILabel new];
    [_pingJiaView addSubview:lable12];
    [lable12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(xianView2);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(woDeLabel2.mas_bottom).mas_equalTo(20);
    }];
    lable12.textColor=ColorWithRGB(79, 79, 79);
    lable12.text=evaluate_content;
    lable12.font=[UIFont systemFontOfSize:17];
    
    _scrollView.contentSize = CGSizeMake(0,720+size3.height);
    
}

-(void)wanChengView2{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_pingJiaView removeFromSuperview];
    NSString *document_content=[_dic objectForKey:@"consult_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(140+size2.height);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"user_nickname"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.width.mas_equalTo(_mainW*0.4);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSNumber *time=[_dic objectForKey:@"consult_time"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=[ZQTools changeTimeCuo:@"YYYY-MM-dd HH:mm:ss" :[NSString stringWithFormat:@"%@",time]];
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    
    NSString *consult_ct_name=[_dic objectForKey:@"consult_ct_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        if (size.width>_mainW*0.4) {
            make.width.mas_equalTo(_mainW*0.4);
        }else
        {
            make.width.mas_equalTo(size.width+14);
        }
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=0;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    UIImageView *imageView2=[UIImageView new];
    [_topView addSubview:imageView2];
    [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.bottom.mas_equalTo(-5);
        make.width.mas_equalTo(22);
        make.height.mas_equalTo(14);
    }];
    imageView2.image=[UIImage imageNamed:@"收起"];
//    imageView2.userInteractionEnabled=YES;
//    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wanChengView)];
//    [imageView2 addGestureRecognizer:tapGesture];
    
    
    UIView *anView=[UIView new];
    [_topView addSubview:anView];
    [anView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(contentLabel);
    }];
    anView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(wanChengView)];
    [anView addGestureRecognizer:tapGesture];
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(15);
        make.width.height.mas_equalTo(50);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=25;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel=[UILabel new];
    [_LSView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    nameLabel.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    for (int i=0; i<biaoQian.count; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    NSData *Data=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.djiaoshou.com/yuyin.gif"]];
    UIImage *image=[UIImage imageWithData:Data];
    
    _shiTing=[UIImageView new];
    [_LSView addSubview:_shiTing];
    [_shiTing mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.height.mas_equalTo(40);
         make.width.mas_equalTo(40/image.size.height*image.size.width);
        make.top.mas_equalTo(userImage.mas_bottom).mas_equalTo(20);
    }];
    _shiTing.image=[UIImage imageNamed:@"录音"];
    _shiTing.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(creatBoFang)];
    [_shiTing addGestureRecognizer:tapGesture4];
    
    UILabel *timelabel=[UILabel new];
    [_LSView addSubview:timelabel];
    [timelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_shiTing.mas_right).mas_equalTo(10);
        make.centerY.mas_equalTo(_shiTing);
    }];
    
    timelabel.textColor=ColorWithRGB(149, 149, 149);
    NSNumber *sl_time_long=[_dic objectForKey:@"sl_time_long"];
    timelabel.text=[NSString stringWithFormat:@"%@'",sl_time_long];
    
    
    NSString *evaluate_content=[_dic objectForKey:@"evaluate_content"];
    CGSize size3=[ZQTools getNSStringSize:evaluate_content andViewWight:_mainW-40 andFont:17];
    _pingJiaView=[UIView new];
    [_scrollView addSubview:_pingJiaView];
    [_pingJiaView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(80+size3.height);
        make.top.mas_equalTo(_LSView.mas_bottom).mas_equalTo(20);
    }];
    _pingJiaView.backgroundColor=[UIColor whiteColor];
    _pingJiaView.layer.cornerRadius=3;
    
    UIView *xianView2=[UIView new];
    [_pingJiaView addSubview:xianView2];
    [xianView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView2.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel2=[UILabel new];
    [_pingJiaView addSubview:woDeLabel2];
    [woDeLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView2);
        make.left.mas_equalTo(xianView2.mas_right).mas_equalTo(10);
    }];
    woDeLabel2.text=@"我的评价";
    woDeLabel2.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel2.font=[UIFont systemFontOfSize:22];
    
    NSNumber *evaluate_score=[_dic objectForKey:@"evaluate_score"];    int typeNum2=evaluate_score.doubleValue*10;
    int typeNum=typeNum2%10;
    int index=5-evaluate_score.floatValue;
  
    
    for (int i=0; i<5; i++) {
        UIImageView *xingImage=[UIImageView new];
        [_pingJiaView addSubview:xingImage];
        [xingImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-10-25*i);
            make.height.width.mas_equalTo(20);
            make.centerY.mas_equalTo(woDeLabel2);
        }];
        
        if (typeNum>0) {
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
            if (i==index) {
                xingImage.image=[UIImage imageNamed:@"评分3"];
            }
            if (i>index) {
                xingImage.image=[UIImage imageNamed:@"评分2"];
            }
        }
        else{
            if (i<index) {
                xingImage.image=[UIImage imageNamed:@"评分1"];
            }
            else{
                xingImage.image=[UIImage imageNamed:@"评分2"];
            }
        }
    }
    
    UILabel *pingFen=[UILabel new];
    [_pingJiaView addSubview:pingFen];
    [pingFen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(woDeLabel2);
        make.right.mas_equalTo(-140);
    }];
    pingFen.text=@"评分:";
    pingFen.textColor=ColorWithRGB(149, 149, 149);
    pingFen.font=[UIFont systemFontOfSize:16];
    
    UILabel *lable12=[UILabel new];
    [_pingJiaView addSubview:lable12];
    [lable12 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(xianView2);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(woDeLabel2.mas_bottom).mas_equalTo(20);
    }];
    lable12.textColor=ColorWithRGB(79, 79, 79);
    lable12.text=evaluate_content;
    lable12.font=[UIFont systemFontOfSize:17];
    
    _scrollView.contentSize = CGSizeMake(0,900+size3.height);
}

-(void)PingJiView{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_pingJiaView removeFromSuperview];
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"user_nickname"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.width.mas_equalTo(_mainW*0.4);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSNumber *time=[_dic objectForKey:@"consult_time"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=[ZQTools changeTimeCuo:@"YYYY-MM-dd HH:mm:ss" :[NSString stringWithFormat:@"%@",time]];
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    NSString *consult_ct_name=[_dic objectForKey:@"consult_ct_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        if (size.width>_mainW*0.4) {
            make.width.mas_equalTo(_mainW*0.4);
        }else
        {
            make.width.mas_equalTo(size.width+14);
        }
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    NSString *document_content=[_dic objectForKey:@"consult_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=3;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    if (size2.height>65) {
        contentLabel.numberOfLines=2;
        UIImageView *imageView2=[UIImageView new];
        [_topView addSubview:imageView2];
        [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(0);
            make.bottom.mas_equalTo(-5);
            make.width.mas_equalTo(22);
            make.height.mas_equalTo(14);
        }];
        imageView2.image=[UIImage imageNamed:@"展开"];

        UIView *anView=[UIView new];
        [_topView addSubview:anView];
        [anView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.mas_equalTo(0);
            make.top.mas_equalTo(contentLabel);
        }];
        anView.userInteractionEnabled=YES;
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(PingJiView2)];
        [anView addGestureRecognizer:tapGesture];
    }
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;
    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(15);
        make.width.height.mas_equalTo(50);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=25;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel=[UILabel new];
    [_LSView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    nameLabel.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    for (int i=0; i<biaoQian.count; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    NSData *Data=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.djiaoshou.com/yuyin.gif"]];
    UIImage *image=[UIImage imageWithData:Data];
    
    _shiTing=[UIImageView new];
    [_LSView addSubview:_shiTing];
    [_shiTing mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(40/image.size.height*image.size.width);
        make.top.mas_equalTo(userImage.mas_bottom).mas_equalTo(20);
    }];
    _shiTing.image=[UIImage imageNamed:@"录音"];
    _shiTing.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(creatBoFang)];
    [_shiTing addGestureRecognizer:tapGesture4];
    
    
    UILabel *timelabel=[UILabel new];
    [_LSView addSubview:timelabel];
    [timelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_shiTing.mas_right).mas_equalTo(10);
        make.centerY.mas_equalTo(_shiTing);
    }];
    
    timelabel.textColor=ColorWithRGB(149, 149, 149);
    NSNumber *sl_time_long=[_dic objectForKey:@"sl_time_long"];
    timelabel.text=[NSString stringWithFormat:@"%@'",sl_time_long];
    
    
    _scrollView.contentSize = CGSizeMake(0,600);
    
}

-(void)PingJiView2{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_pingJiaView removeFromSuperview];
    NSString *document_content=[_dic objectForKey:@"consult_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];
    
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(140+size2.height);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;
    
    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];
    
    NSString *phoneStr=[_dic objectForKey:@"user_nickname"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.width.mas_equalTo(_mainW*0.4);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];
    
    NSNumber *time=[_dic objectForKey:@"consult_time"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=[ZQTools changeTimeCuo:@"YYYY-MM-dd HH:mm:ss" :[NSString stringWithFormat:@"%@",time]];
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    
    
    NSString *consult_ct_name=[_dic objectForKey:@"consult_ct_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        if (size.width>_mainW*0.4) {
            make.width.mas_equalTo(_mainW*0.4);
        }else
        {
            make.width.mas_equalTo(size.width+14);
        }
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;
    
    
    
    
    
    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=0;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];
    
    UIImageView *imageView2=[UIImageView new];
    [_topView addSubview:imageView2];
    [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.bottom.mas_equalTo(-5);
        make.width.mas_equalTo(22);
        make.height.mas_equalTo(14);
    }];
    imageView2.image=[UIImage imageNamed:@"收起"];
    
    UIView *anView=[UIView new];
    [_topView addSubview:anView];
    [anView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(contentLabel);
    }];
    anView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(PingJiView)];
    [anView addGestureRecognizer:tapGesture];
    
    
    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;

    
    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;
    
    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];
    
    
    NSDictionary *lawyer_info=[_dic objectForKey:@"lawyer_info"];
    
    UIImageView *userImage=[UIImageView new];
    [_LSView addSubview:userImage];
    [userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(woDeLabel.mas_bottom).mas_equalTo(15);
        make.width.height.mas_equalTo(50);
    }];
    userImage.layer.masksToBounds=YES;
    userImage.layer.cornerRadius=25;
    NSString *waiter_icon=[lawyer_info objectForKey:@"waiter_icon"];
    waiter_icon=[NSString stringWithFormat:@"%@%@",_addressUrl,waiter_icon];
    [userImage sd_setImageWithURL:[NSURL URLWithString:waiter_icon]];
    
    UILabel *nameLabel=[UILabel new];
    [_LSView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(userImage.mas_top);
        make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15);
    }];
    nameLabel.textColor=ColorWithRGB(49, 49, 49);
    nameLabel.text=[lawyer_info objectForKey:@"waiter_name"];
    nameLabel.font=[UIFont systemFontOfSize:17];
    float width=0;
    
    NSString *wl_field_names=[lawyer_info objectForKey:@"wl_field_names"];
    
    NSArray *biaoQian=[wl_field_names componentsSeparatedByString:@","];
    for (int i=0; i<biaoQian.count; i++) {
        NSString *biaoStr=biaoQian[i];
        CGSize size=[ZQTools getNSStringWeight:biaoStr andViewWight:16 andFont:16 ];
        
        UILabel *label=[UILabel new];
        [_LSView addSubview:label];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(userImage.mas_right).mas_equalTo(15+width);
            make.height.mas_equalTo(20);
            make.width.mas_equalTo(size.width+16);
            make.bottom.mas_equalTo(userImage);
        }];
        label.text=biaoQian[i];
        label.font=[UIFont systemFontOfSize:16];
        label.textColor=ColorWithRGB(149, 149, 149);
        label.layer.cornerRadius=4;
        label.layer.borderColor=ColorWithRGB(149,149, 149).CGColor;
        label.layer.borderWidth=1;
        label.textAlignment=NSTextAlignmentCenter;
        width=width+size.width+30;
    }
    
    NSData *Data=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.djiaoshou.com/yuyin.gif"]];
    UIImage *image=[UIImage imageWithData:Data];
    
    _shiTing=[UIImageView new];
    [_LSView addSubview:_shiTing];
    [_shiTing mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(40/image.size.height*image.size.width);
        make.top.mas_equalTo(userImage.mas_bottom).mas_equalTo(20);
    }];
    _shiTing.image=[UIImage imageNamed:@"录音"];
    _shiTing.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(creatBoFang)];
    [_shiTing addGestureRecognizer:tapGesture4];
    
    UILabel *timelabel=[UILabel new];
    [_LSView addSubview:timelabel];
    [timelabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_shiTing.mas_right).mas_equalTo(10);
        make.centerY.mas_equalTo(_shiTing);
    }];
    
    timelabel.textColor=ColorWithRGB(149, 149, 149);
    NSNumber *sl_time_long=[_dic objectForKey:@"sl_time_long"];
    timelabel.text=[NSString stringWithFormat:@"%@'",sl_time_long];
    
    
    
    _scrollView.contentSize = CGSizeMake(0,600+size2.height);
    
}


-(void)LvSiFuWu{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_pingJiaView removeFromSuperview];
    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;

    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];

    NSString *phoneStr=[_dic objectForKey:@"user_nickname"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.width.mas_equalTo(_mainW*0.4);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];

    NSNumber *time=[_dic objectForKey:@"consult_time"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=[ZQTools changeTimeCuo:@"YYYY-MM-dd HH:mm:ss" :[NSString stringWithFormat:@"%@",time]];
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);

    NSString *consult_ct_name=[_dic objectForKey:@"consult_ct_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        if (size.width>_mainW*0.4) {
            make.width.mas_equalTo(_mainW*0.4);
        }else
        {
            make.width.mas_equalTo(size.width+14);
        }
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;


    NSString *document_content=[_dic objectForKey:@"consult_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];

    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=3;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];

    if (size2.height>65) {
        contentLabel.numberOfLines=2;
        UIImageView *imageView2=[UIImageView new];
        [_topView addSubview:imageView2];
        [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(0);
            make.bottom.mas_equalTo(-5);
            make.width.mas_equalTo(22);
            make.height.mas_equalTo(14);
        }];
        imageView2.image=[UIImage imageNamed:@"展开"];
        
        UIView *anView=[UIView new];
        [_topView addSubview:anView];
        [anView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.mas_equalTo(0);
            make.top.mas_equalTo(contentLabel);
        }];
        anView.userInteractionEnabled=YES;
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LvSiFuWu2)];
        [anView addGestureRecognizer:tapGesture];
    }

    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;

    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;

    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];

    UIImageView *lsImage=[UIImageView new];
    [_LSView addSubview:lsImage];
    [lsImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(60);
    }];
    lsImage.image=[UIImage imageNamed:@"律师服务"];

    UILabel *dengDai=[UILabel new];
    [_LSView addSubview:dengDai];
    [dengDai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(lsImage.mas_right).mas_equalTo(20);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-20);
    }];
    dengDai.text=@"律师正在服务，请耐心等待...";
    dengDai.textColor=ColorWithRGB(219, 175, 0);
    dengDai.font=[UIFont systemFontOfSize:22];

    _scrollView.contentSize = CGSizeMake(0,600);

}

-(void)LvSiFuWu2{
    [_topView removeFromSuperview];
    [_LSView removeFromSuperview];
    [_pingJiaView removeFromSuperview];
    NSString *document_content=[_dic objectForKey:@"consult_content"];
    CGSize size2=[ZQTools getNSStringSize:document_content andViewWight:_mainW-30 andFont:16];

    _topView=[UIView new];
    [_scrollView addSubview:_topView];
    [_topView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(5);
        make.width.mas_equalTo(_mainW-10);
        make.height.mas_equalTo(140+size2.height);
        make.top.mas_equalTo(190);
    }];
    _topView.backgroundColor=[UIColor whiteColor];
    _topView.layer.cornerRadius=3;

    UIImageView *iamgeView=[UIImageView new];
    [_topView addSubview:iamgeView];
    [iamgeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(20);
        make.width.height.mas_equalTo(60);
    }];
    iamgeView.layer.cornerRadius=30;
    iamgeView.layer.masksToBounds=YES;
    NSString *news_cover=[_dic objectForKey:@"user_icon"];
    news_cover=[NSString stringWithFormat:@"%@%@",_addressUrl,news_cover];
    [iamgeView sd_setImageWithURL:[NSURL URLWithString:news_cover]];

    NSString *phoneStr=[_dic objectForKey:@"user_nickname"];
    UILabel *label=[UILabel new];
    [_topView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(iamgeView.mas_right).mas_equalTo(6);
        make.top.mas_equalTo(iamgeView);
        make.width.mas_equalTo(_mainW*0.4);
    }];
    label.text=phoneStr;
    label.textColor=ColorWithRGB(49, 49, 49);
    label.font=[UIFont systemFontOfSize:17];

    NSNumber *time=[_dic objectForKey:@"consult_time"];
    UILabel *timeLabel=[UILabel new];
    [_topView addSubview:timeLabel];
    [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(label);
        make.bottom.mas_equalTo(iamgeView);
    }];
    timeLabel.text=[ZQTools changeTimeCuo:@"YYYY-MM-dd HH:mm:ss" :[NSString stringWithFormat:@"%@",time]];
    timeLabel.font=[UIFont systemFontOfSize:14];
    timeLabel.textColor=ColorWithRGB(149, 149, 149);
    

    NSString *consult_ct_name=[_dic objectForKey:@"consult_ct_name"];
    CGSize size=[ZQTools getNSStringWeight:consult_ct_name andViewWight:20 andFont:18];
    UILabel *ct_nameLabel=[UILabel new];
    [_topView addSubview:ct_nameLabel];
    [ct_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(30);
        make.centerY.mas_equalTo(label);
        if (size.width>_mainW*0.4) {
            make.width.mas_equalTo(_mainW*0.4);
        }else
        {
            make.width.mas_equalTo(size.width+14);
        }
    }];
    ct_nameLabel.text=consult_ct_name;
    ct_nameLabel.font=[UIFont systemFontOfSize:16];
    ct_nameLabel.textColor=ColorWithRGB(76, 169, 221);
    [ct_nameLabel layoutIfNeeded];
    ct_nameLabel.textAlignment=NSTextAlignmentCenter;
    ct_nameLabel.layer.cornerRadius=4;
    ct_nameLabel.layer.borderWidth=1;
    ct_nameLabel.layer.borderColor=ColorWithRGB(76, 169, 221).CGColor;


    UILabel *contentLabel=[UILabel new];
    [_topView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(10);
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(timeLabel.mas_bottom).mas_equalTo(20);
    }];
    contentLabel.numberOfLines=0;
    contentLabel.text=document_content;
    contentLabel.textColor=ColorWithRGB(149, 149, 149);
    contentLabel.font=[UIFont systemFontOfSize:16];

    UIImageView *imageView2=[UIImageView new];
    [_topView addSubview:imageView2];
    [imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.bottom.mas_equalTo(-5);
        make.width.mas_equalTo(22);
        make.height.mas_equalTo(14);
    }];
    imageView2.image=[UIImage imageNamed:@"收起"];
//    imageView2.userInteractionEnabled=YES;
//    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LvSiFuWu)];
//    [imageView2 addGestureRecognizer:tapGesture];
    
    
    UIView *anView=[UIView new];
    [_topView addSubview:anView];
    [anView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.mas_equalTo(0);
        make.top.mas_equalTo(contentLabel);
    }];
    anView.userInteractionEnabled=YES;
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(LvSiFuWu)];
    [anView addGestureRecognizer:tapGesture];

    _LSView=[UIView new];
    [_scrollView addSubview:_LSView];
    [_LSView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(_topView);
        make.height.mas_equalTo(180);
        make.top.mas_equalTo(_topView.mas_bottom).mas_equalTo(20);
    }];
    _LSView.backgroundColor=[UIColor whiteColor];
    _LSView.layer.cornerRadius=3;

    UIView *xianView=[UIView new];
    [_LSView addSubview:xianView];
    [xianView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(3);
        make.height.mas_equalTo(20);
    }];
    xianView.backgroundColor=_backgroundColor;

    UILabel *woDeLabel=[UILabel new];
    [_LSView addSubview:woDeLabel];
    [woDeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(xianView);
        make.left.mas_equalTo(xianView.mas_right).mas_equalTo(10);
    }];
    woDeLabel.text=@"我的律师";
    woDeLabel.textColor=ColorWithRGB(49, 49, 49);
    woDeLabel.font=[UIFont systemFontOfSize:22];

    UIImageView *lsImage=[UIImageView new];
    [_LSView addSubview:lsImage];
    [lsImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.centerY.mas_equalTo(0);
        make.width.mas_equalTo(50);
        make.height.mas_equalTo(60);
    }];
    lsImage.image=[UIImage imageNamed:@"律师服务"];

    UILabel *dengDai=[UILabel new];
    [_LSView addSubview:dengDai];
    [dengDai mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(lsImage.mas_right).mas_equalTo(20);
        make.centerY.mas_equalTo(0);
        make.right.mas_equalTo(-20);
    }];
    dengDai.text=@"律师正在服务，请耐心等待...";
    dengDai.textColor=ColorWithRGB(219, 175, 0);
    dengDai.font=[UIFont systemFontOfSize:22];

    _scrollView.contentSize = CGSizeMake(0,540+size2.height);

}


-(void)SelectDocument:(UITapGestureRecognizer *)tap{
    SelectCaseView *addView=[SelectCaseView new];
    [self addSubview:addView];
    [addView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.mas_equalTo(0);
    }];
    addView.customSelectedBlock = ^ (NSDictionary *dic)
    {
        _documentDic=dic;
        _leiXinLabel.text=[dic objectForKey:@"ct_name"];
    };
    addView.index2=2;
    [addView creatView];
}

-(IBAction)tiJiao:(id)sender{
    NSString *ramekStr=_textView.text;
    if (_documentDic==nil) {
        [ZQTools svpInfo:@"请选择案件类型"];
        return;
    }
    if ([ramekStr isEqualToString:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"]||[ZQTools charIsNil:ramekStr]) {
        [ZQTools svpInfo:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"];
        return;
    }

    PayView3Controller *pay=[[PayView3Controller alloc]init];
    pay.dic=_documentDic;
    pay.ramekStr=ramekStr;
    [ZQTools pushNextViewController:self.viewController andRootController:pay];

}
-(IBAction)tiJiao2:(id)sender{
    

    NSString *ramekStr=_textView.text;
    if (_documentDic==nil) {
        [ZQTools svpInfo:@"请选择案件类型"];
        return;
    }
    if ([ramekStr isEqualToString:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"]||[ZQTools charIsNil:ramekStr]) {
        [ZQTools svpInfo:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"];
        return;
    }
    
    NSDictionary *userDic = [NSKeyedUnarchiver unarchiveObjectWithFile:_userModelFile];
    NSString *token=[userDic objectForKey:@"token"];
    NSNumber *waiter_id1=[userDic objectForKey:@"user_id"];
    NSString *user_id=[NSString stringWithFormat:@"%@",waiter_id1];
    
    NSNumber *dt_id1=[_documentDic objectForKey:@"ct_id"];
    NSString *dt_id=[NSString stringWithFormat:@"%@",dt_id1];
   
    
    NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:token,@"token",@"0",@"user_role",user_id,@"user_id",dt_id,@"ct_id",ramekStr,@"consult_content",@"0",@"consult_money", nil];
    [ZQTools AFNPostDataUrl:@"user/consult/send_consult" Dict:dic andTableView:nil andViewController:self.viewController andSuccessBlock:^(id responseObject) {
        NSDictionary *dic=[NSDictionary dictionaryWithObjectsAndKeys:responseObject,@"consult_id",@"免费咨询",@"neixin", nil];
        OKViewController *okView=[[OKViewController alloc] init];
        okView.dic=dic;
        [ZQTools pushNextViewController:self.viewController andRootController:okView];
    } anderrorBlock:nil  ];
    
}

-(IBAction)pijiama:(id)sender{
    PingJiaViewController *pingJia=[PingJiaViewController new];
    pingJia.evaluate_services_id=[_dic objectForKey:@"consult_id"];
    pingJia.evaluate_services_type=@0;
    pingJia.evaluate_waiter_id=[_dic objectForKey:@"assign_waiter_id"];
    [ZQTools pushNextViewController:self.viewController andRootController:pingJia];
}

-(void)creatBoFang{
    
    NSData *Data=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.djiaoshou.com/yuyin.gif"]];
    UIImage *image=[UIImage imageWithData:Data];
    
    _GifImageView=[UIImageView new];
    [self addSubview:_GifImageView];
    [_GifImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(_shiTing);
        make.left.mas_equalTo(_shiTing);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(40/image.size.height*image.size.width);
    }];
    _shiTing.hidden=YES;
    _shiTing.userInteractionEnabled=NO;
    
    
    NSString  *name = @"yuyin.gif";
    NSString  *filePath = [[NSBundle bundleWithPath:[[NSBundle mainBundle] bundlePath]] pathForResource:name ofType:nil];
    NSData  *imageData = [NSData dataWithContentsOfFile:filePath];
    
    _GifImageView.image = [UIImage sd_animatedGIFWithData:imageData];

    
    NSString *videoFilePath=[NSString stringWithFormat:@"%@%@",_addressUrl,[_dic objectForKey:@"sl_file"]];
    NSURL * url = [NSURL URLWithString:videoFilePath];
    self.player = [[SUPlayer new] initWithURL:url];
    [self.player addObserver:self forKeyPath:@"progress" options:NSKeyValueObservingOptionNew context:nil];
    [self.player addObserver:self forKeyPath:@"duration" options:NSKeyValueObservingOptionNew context:nil];
    [self.player addObserver:self forKeyPath:@"cacheProgress" options:NSKeyValueObservingOptionNew context:nil];
   
    [self.player play];
}

-(void)textViewDidBeginEditing:(UITextView *)textView{
    if ([textView.text isEqualToString:@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…"]) {
        textView.text=@"";
    }
    textView.textColor=ColorWithRGB(49, 49, 40);
    
}
-(void)textViewDidEndEditing:(UITextView *)textView{
    if ([textView.text isEqualToString:@""]) {
        textView.text=@"请详细输入你要写的文书需求，如案情经过、证据情况、以便律师更好地为您服务…";
        textView.textColor=ColorWithRGB(220 , 220, 220);
    }
    else{
        textView.textColor=ColorWithRGB(49 , 59, 49);
    }
    
}

-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    _numLabel.text=[NSString stringWithFormat:@"%ld/200",textView.text.length - range.length + text.length];
    if ([text isEqualToString:@"\n"]){ //判断输入的字是否是回车，即按下return
        
        [_textView resignFirstResponder];        //在这里做你响应return键的代码
        return NO; //这里返回NO，就代表return键值失效，即页面上按下return，不会出现换行，如果为yes，则输入页面会换行
    }
    if ([[[UITextInputMode currentInputMode]primaryLanguage] isEqualToString:@"emoji"]) {
        return NO;
    }
    if ((textView.text.length - range.length + text.length) > 200)
    {
        
        
        NSString *substring = [text substringToIndex:200 - (textView.text.length - range.length)];
        NSMutableString *lastString = [textView.text mutableCopy];
        [lastString replaceCharactersInRange:range withString:substring];
        textView.text = [lastString copy];
        return NO;
    }
    else
    {
        return YES;
    }
}


- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context {
    if ([keyPath isEqualToString:@"progress"]) {
        [self convertStringWithTime2];
        
    }
    if ([keyPath isEqualToString:@"duration"]) {
        if (self.player.duration > 0) {
            //            self.timeLabel.text = [self convertStringWithTime:self.player.duration];
            //            self.timeLabel.hidden = NO;
        }else {
            //            self.timeLabel.hidden = YES;
            
        }
    }
    if ([keyPath isEqualToString:@"cacheProgress"]) {
        
    }
}
- (NSString *)convertStringWithTime2 {
    
    
    int timelength=self.player.duration-self.player.duration * self.player.progress;
    if (isnan(timelength)) timelength = 0.f;
    int min = timelength / 60.0;
    int sec = timelength - min * 60;
    NSString * minStr = min > 9 ? [NSString stringWithFormat:@"%d",min] : [NSString stringWithFormat:@"0%d",min];
    NSString * secStr = sec > 9 ? [NSString stringWithFormat:@"%d",sec] : [NSString stringWithFormat:@"0%d",sec];
    NSString * timeStr = [NSString stringWithFormat:@"%@:%@",minStr, secStr];
    if ([timeStr isEqualToString:@"00:01"]) {
        
        [_GifImageView removeFromSuperview];
        _shiTing.hidden=NO;
        _shiTing.userInteractionEnabled=YES;;
    }
    
    return timeStr;
}


@end
